<?php

/**
 * Faktura form base class.
 *
 * @package    marketing
 * @subpackage form
 * @author     Your name here
 */
class BaseFakturaForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                            => new sfWidgetFormInputHidden(),
      'datum_fakturisanja'            => new sfWidgetFormDateTime(),
      'vrsta_dakture'                 => new sfWidgetFormInput(),
      'nalog_prodaje_id'              => new sfWidgetFormPropelChoice(array('model' => 'NalogProdaje', 'add_empty' => false)),
      'ukupan_isnos_po_nabavnoj_ceni' => new sfWidgetFormInput(),
      'ukupan_porez'                  => new sfWidgetFormInput(),
      'transportni_troskovi'          => new sfWidgetFormInput(),
      'ukupan_iznos_racuna'           => new sfWidgetFormInput(),
      'profit'                        => new sfWidgetFormInput(),
      'created_at'                    => new sfWidgetFormDateTime(),
      'updated_at'                    => new sfWidgetFormDateTime(),
      'deleted_at'                    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                            => new sfValidatorPropelChoice(array('model' => 'Faktura', 'column' => 'id', 'required' => false)),
      'datum_fakturisanja'            => new sfValidatorDateTime(),
      'vrsta_dakture'                 => new sfValidatorString(array('max_length' => 45)),
      'nalog_prodaje_id'              => new sfValidatorPropelChoice(array('model' => 'NalogProdaje', 'column' => 'id')),
      'ukupan_isnos_po_nabavnoj_ceni' => new sfValidatorNumber(),
      'ukupan_porez'                  => new sfValidatorNumber(),
      'transportni_troskovi'          => new sfValidatorNumber(),
      'ukupan_iznos_racuna'           => new sfValidatorNumber(),
      'profit'                        => new sfValidatorNumber(),
      'created_at'                    => new sfValidatorDateTime(array('required' => false)),
      'updated_at'                    => new sfValidatorDateTime(array('required' => false)),
      'deleted_at'                    => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('faktura[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Faktura';
  }


}
